package cn.iocoder.yudao.module.study.accessLimit.controller.admin;

import cn.iocoder.yudao.module.study.accessLimit.annotation.AccessLimit;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author cjc
 * @Date 2024/3/20 17:13
 * @Description: 接口防刷 Controller
 * @Version 1.0
 */
@RestController
@RequestMapping("/access/limit")
@Slf4j
@AccessLimit(second = 60,maxTime = 5,forbiddenTime = 120)
public class AccessLimitController {

    @GetMapping("/getOne/{id}")
    public String getOne(@PathVariable("id") Integer id){
        log.info("执行[pass]-getOne()方法，id为{}", id);
        return "请求成功";
    }

    @GetMapping("/getTwo/{id}")
    @AccessLimit(second = 60,maxTime = 1,forbiddenTime = 120)
    public String getTwo(@PathVariable("id") Integer id){
        log.info("执行[pass]-getTwo()方法，id为{}", id);
        return "请求成功";
    }
}
